{% extends 'bootstrap/base.html' %}

{% block title %}首页{% endblock %}
{% block styles %}
    {{ super() }}
    <style>
        #myfooter {
            font-size: 14px;
            text-align: center;
            color: darkgrey;
            border-top: 1px solid dimgray;
            margin: 0 auto;
        }
    </style>
{% endblock %}

{% block navbar %}
    <nav class="navbar navbar-default">
        <div class="container-fluid">
            <!-- Brand and toggle get grouped for better mobile display -->
            <div class="navbar-header">
                <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                        data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                    <span class="sr-only">Toggle navigation</span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                    <span class="icon-bar"></span>
                </button>
                <a class="navbar-brand" href="#">个人博客</a>
            </div>

            <!-- Collect the nav links, forms, and other content for toggling -->
            <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                <ul class="nav navbar-nav">
                    <li class="active"><a href="{{ url_for('user.index') }}">首&nbsp;&nbsp;页 <span
                            class="sr-only">(current)</span></a></li>
                    <li><a href="{{ url_for('user.show_about') }}">关于我</a></li>
                    <li class="dropdown">
                        <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                           aria-haspopup="true"
                           aria-expanded="false">文章分类 <span class="caret"></span></a>
                        <ul class="dropdown-menu">
                            {% for type in g.article_types %}
                                {% if loop.first %}
                                    <li>
                                        <a href="{{ url_for('article.type_search') }}?tid={{ type.id }}">{{ type.type_name }}</a>
                                    </li>
                                    <li role="separator" class="divider"></li>
                                {% else %}
                                    <li>
                                        <a href="{{ url_for('article.type_search') }}?tid={{ type.id }}">{{ type.type_name }}</a>
                                    </li>
                                {% endif %}
                            {% endfor %}

                        </ul>
                    </li>
                    <li><a href="{{ url_for('user.myphoto') }}">我的相册</a></li>
                    <li><a href="{{ url_for('user.show_board') }}">留言板</a></li>
                </ul>
                <form class="navbar-form navbar-left">
                    <div class="form-group">
                        <input type="text" class="form-control" placeholder="Search">
                    </div>
                    <button type="submit" class="btn btn-default">搜索</button>
                </form>

                <ul class="nav navbar-nav navbar-right">
                    {% if user %}
                        <li class="dropdown">
                            <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button"
                               aria-haspopup="true" aria-expanded="false"><img
                                    src="{% if user.icon %}  {{ url_for('static',filename=user.icon) }} {% else %}{{ url_for('static',filename='images/touxiang.jpg') }}{% endif %}"
                                    alt="" width="30"
                                    style="border-radius: 15px;margin-right: 5px">欢迎&nbsp;&nbsp;{{ user.username }}
                                <span
                                        class="caret"></span></a>
                            <ul class="dropdown-menu">
                                <li><a href="{{ url_for('user.center') }}">用户中心</a></li>
                                <li role="separator" class="divider"></li>
                                <li><a href="{{ url_for('user.logout') }}">退出</a></li>
                            </ul>
                        </li>
                    {% else %}
                        <li><a href="{{ url_for('user.login') }}">登录</a></li>
                        <li><a href="{{ url_for('user.register') }}">注册</a></li>
                    {% endif %}
                </ul>

            </div><!-- /.navbar-collapse -->
        </div><!-- /.container-fluid -->
    </nav>
{% endblock %}
<div class="col-lg-12 col-md-12 col-sm-12">
    {% block content %}
        {#        <div class="col-lg-12 col-md-12 col-sm-12">#}
        {#            {% block newcontent %}#}
        {#                <h1>这是内容</h1>#}
        {#            {% endblock %}#}
        {#        </div>#}
    {% endblock %}
</div>
{% block footer %}
    <div id="myfooter">
        <p>京ICP备11008151号-6京公网安备11010802014853</p>
    </div>
{% endblock %}


